//
//  MyActivityDetailViewController.m
//  WheatPlan
//
//  Created by 郑渊文 on 7/1/15.
//  Copyright (c) 2015 IOSTeam. All rights reserved.
//

#import "MyActivityDetailViewController.h"

@interface MyActivityDetailViewController ()

@end

@implementation MyActivityDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSDictionary *param4 = @{@"activityId":@"1",@"userId":@"1",@"typeId":_typeId};
//    ////NSLog(@"====================%@",_classId);
    [UserDAL getOutDoorActivityDetailsWithParams:param4 withBlock:^(NSDictionary *data, NSError *error) {
        if (data) {
            ////NSLog(@"what%@",data);
            _DetailText = data[@"classIntroduce"];
            //            for (NSDictionary *mydic in array) {
            //
            //            }
            
            
        }else
        {
            
        }
    }];
    
    
    _DetailText= @"Acting as if nothing borne in mind is the best revenge.It's all for myself to live better.Every day may not be good…but there's something good in every day.Happiness is about having each tiny wish come ture.A woman has got to love a bad man once or twice in her life to be thankful for a good one.";
    
    [self initSubViews];
    self.navigationItem.title = @"活动详情";
    [self.navigationController.navigationBar setTranslucent:NO];//设置navigationbar的半透明
    [self.navigationController.navigationBar setBarTintColor:[GetFileModel colorWithHexString:@"#34bd81" alpha:1]];
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];

    //    self.navigationItem.rightBarButtonItem.title = @"课程详情";
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)viewDidAppear:(BOOL)animated
{
    
}

-(void)initSubViews
{
    //自定义左右按钮
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    
    [button setBackgroundImage:[UIImage imageNamed:@"_0000_返回.png"]
     
                      forState:UIControlStateNormal];
    
    [button addTarget:self action:@selector(back)
     
     forControlEvents:UIControlEventTouchUpInside];
    
    button.frame = CGRectMake(0, 0, 20, 15);
    
    
    
    UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
    
    
    
    self.navigationItem.leftBarButtonItem = menuButton;
    
    UIView *bgView = [[UIView alloc]initWithFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    [self.view addSubview:bgView];
    bgView.backgroundColor = [UIColor whiteColor];
    
    UILabel *intrTitle = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/2-100, 10, 200, 60)];
    intrTitle.text = @"活动介绍";
    intrTitle.textAlignment = NSTextAlignmentCenter;
    intrTitle.font  = [UIFont systemFontOfSize:25];
    intrTitle.textColor = [UIColor blackColor];
    [bgView addSubview:intrTitle];
    
    UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(0, 70, SCREEN_WIDTH, 1)];
    lineView.backgroundColor = UIColorWithRGBA(215, 215, 215, 1);
    [bgView addSubview:lineView];
    
    UILabel *introduceLable = [[UILabel alloc]initWithFrame:CGRectMake(0, 10, SCREEN_WIDTH-20, 60)];
    introduceLable.numberOfLines = 0;
    introduceLable.font = [UIFont fontWithName:@"Helvetica" size:13];
    
    NSString *text = _DetailText;
    
    UIFont *font = [UIFont fontWithName:@"Helvetica" size:13.0];
    CGSize size = [text sizeWithFont:font constrainedToSize:CGSizeMake(SCREEN_WIDTH-20, 2000.0f)
                       lineBreakMode:NSLineBreakByWordWrapping];
    CGRect rect = introduceLable.frame;
    rect.size = size;
    float viewHeight = size.height;
    [introduceLable setFrame:rect];
    [introduceLable setText:text];
    
    UIView *introduceView = [[UIView alloc]initWithFrame:CGRectMake(10, 80, SCREEN_WIDTH-20, 40+viewHeight)];
    introduceView.backgroundColor = [UIColor whiteColor];
    introduceView.layer.borderColor = [UIColor clearColor].CGColor;
    introduceView.backgroundColor = [UIColor whiteColor];
    introduceView.layer.borderWidth = 1;
    
    [bgView addSubview:introduceView];
    [introduceView addSubview:introduceLable];
    
    
    //    UIButton *myBtn = [[UIButton alloc]initWithFrame:CGRectMake(50, SCREEN_HEIGHT-150, SCREEN_WIDTH-100, 40)];
    //    [myBtn setTitle:@"早教上门" forState:UIControlStateNormal];
    //    [myBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    //    [myBtn addTarget:self action:@selector(doorToTeach) forControlEvents:UIControlEventTouchUpInside];
    //    myBtn.backgroundColor = UIColorWithRGBA(227, 90,92, 1);
    //    [bgView addSubview:myBtn];
    
}

//-(void)doorToTeach
//{
//    StoreViewController *setVC = [[StoreViewController alloc]init];
//    UINavigationController * nav = [[UINavigationController alloc]initWithRootViewController:setVC];
//    [self  presentViewController:nav animated:YES completion:nil];
//}

-(void)back
{
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}

@end
